<div style="background-color: #eee">
  <h3>配置信息</h3>
  <p>
    titleId: <input type="text" [(ngModel)]="titleId">
    从<a href="https://developer.playfab.com/zh-CN/my-games" target="_blank">这里</a>创建一个游戏然后复制
  </p>
  <p>
    文档链接：
    <a target="_blank"
       href="https://learn.microsoft.com/en-us/rest/api/playfab/client/authentication/register-playfab-user?view=playfab-rest">注册</a>、
    <a target="_blank"
       href="https://learn.microsoft.com/en-us/rest/api/playfab/client/authentication/login-with-playfab?view=playfab-rest">登陆</a>、
    <a target="_blank"
       href="https://learn.microsoft.com/en-us/rest/api/playfab/client/player-data-management/update-user-data?view=playfab-rest">更新数据</a>、
    <a target="_blank"
       href="https://learn.microsoft.com/en-us/rest/api/playfab/client/player-data-management/get-user-data?view=playfab-rest">获取数据</a>
  </p>
</div>
<div *ngIf="!isLogin && !isRegister">
  <h1>登陆</h1>
  <table>
    <tr>
      <td>用户名</td>
      <td>
        <input type="text" [(ngModel)]="userLogin.username"
               placeholder="请输入3-20位用户名" minlength="3" maxlength="20">
      </td>
    </tr>
    <tr>
      <td>密码</td>
      <td>
        <input type="text" [(ngModel)]="userLogin.password"
               placeholder="请输入6-100位用户名" minlength="6" maxlength="100">
      </td>
    </tr>
    <tr>
      <td>
        <button (click)="login()">登陆</button>
      </td>
      <td>
        <button (click)="toRegister()">注册</button>
      </td>
    </tr>
  </table>
</div>
<div *ngIf="isRegister">
  <h1>注册</h1>
  <table>
    <tr>
      <td>用户名</td>
      <td>
        <input type="text" [(ngModel)]="userLogin.username"
               placeholder="请输入3-20位用户名" minlength="3" maxlength="20">
      </td>
    </tr>
    <tr>
      <td>密码</td>
      <td>
        <input type="text" [(ngModel)]="userLogin.password"
               placeholder="请输入6-100位用户名" minlength="6" maxlength="100">
      </td>
    </tr>
    <tr>
      <td>
        <button (click)="register()">注册</button>
      </td>
      <td>
        <button (click)="toLogin()">返回登陆</button>
      </td>
    </tr>
  </table>
</div>
<div *ngIf="isLogin">
  用户名:{{loginData.Username}}
  <button (click)="logout()">注销</button>
  <br>
  <button (click)="updateUserData()">将数据上传到云端</button>
  <button (click)="getUserData()">从云端拉取数据</button>
  <br>
  数据1:<textarea rows="3" [(ngModel)]="data1"></textarea>
  <br>
  数据2:<textarea rows="3" [(ngModel)]="data2"></textarea>
</div>
<span *ngIf="errorMsg" style="color:red">{{errorMsg}}</span>
<span *ngIf="infoMsg" style="color:orange">{{infoMsg}}</span>

